home *** CD-ROM | disk | FTP | other *** search
- on DBSetUp
- global gDBSearchFile, gHardDriveP, gDBSearchPath, gOriginPath, gDBRecipeID, gDBTitle, gDBChapter, gDBServings, gDBPrepTime, gDBDishType, gDBIngredient, gDBInstruction, gDBInstructionType, gDBBeauty, gDBRamble, gDBDescription, gDBSubTitle, gDBAuthorName, gDBOriginalBook, gDBOrganization, gDBCity, gDBState, gDBCalories, gDBCholesterol, gDBCarbohydrates, gDBProtein, gDBSodium, gDBFat, gDBSaturated, gDBPotassium, gDBEvent1, gDBEvent2, gDBEvent3, gDBEvent4, gDBQuantity, gDBUnit, gDBNoQuantity, gDBCollate, gDBVideoLinks, gDBTermID, gDBTermName, gDBTermDefinition, gDBTermLinks, gDBTermPhotoID, gDBTermPhotoFile, gDBPhotoTitle, gDBPhotoCaption, gDBNutritionID, gDBNutritionFood, gDBNutritionUnit, gDBNutritionList, gDBUtensilID, gDBUtensilName, gDBUtensilText, gDBTableText, gDBSearchMenu, gDBSearchIngredient, gDBResult, gGRkeyID, gGRDBNum, gDBSearchIngredients, gDBSearchMenus, gDBMenuIDs, gDBMenuTypes
- if gHardDriveP then
- set gDBSearchPath to gOriginPath
- else
- set gDBSearchPath to the pathName
- end if
- set gDBRecipeID to 0
- set gDBChapter to 1
- set gDBTitle to 2
- set gDBPrepTime to 2001
- set gDBDishType to 9001
- set gDBInstruction to 20005
- set gDBIngredient to 20006
- set gDBInstructionType to 3001
- set gDBBeauty to 1001
- set gDBRamble to 20001
- set gDBDescription to 20002
- set gDBAuthorName to 6
- set gDBOriginalBook to 7
- set gDBOrganization to 8
- set gDBCity to 9
- set gDBState to 10
- set gDBSubTitle to 3
- set gDBServings to 12
- set gDBCalories to 13
- set gDBCholesterol to 14
- set gDBCarbohydrates to 15
- set gDBProtein to 16
- set gDBSodium to 17
- set gDBFat to 18
- set gDBSaturated to 19
- set gDBPotassium to 20
- set gDBEvent1 to 23
- set gDBEvent2 to 20
- set gDBEvent3 to 21
- set gDBEvent4 to 22
- set gDBQuantity to 4001
- set gDBUnit to 4002
- set gDBNoQuantity to 4003
- set gDBCollate to 4004
- set gDBVideoLinks to 20000
- set gDBTermID to 5000
- set gDBTermName to 5001
- set gDBTermDefinition to 20003
- set gDBTermLinks to 20004
- set gDBTermPhotoID to 6000
- set gDBTermPhotoFile to 6001
- set gDBPhotoTitle to 6002
- set gDBPhotoCaption to 20004
- set gDBNutritionID to 7000
- set gDBNutritionFood to 7001
- set gDBNutritionUnit to 7002
- set gDBNutritionList to [7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011]
- set gDBUtensilID to 8000
- set gDBUtensilName to 8001
- set gDBUtensilText to 20007
- set gDBTableText to 20000
- set gDBSearchMenu to 20002
- set gDBSearchIngredient to 20006
- set gDBResult to 0
- set gGRkeyID to 0
- set gGRDBNum to 0
- set gDBSearchIngredients to []
- set gDBSearchMenus to []
- set gDBMenuIDs to [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
- set gDBMenuTypes to ["fat": "Low: < 3 g", "saturated": "Low: < 1 g", "sodium": "Low: < 140 mg", "sodium": "Very low: < 35 mg", "calories": "Low: < 40", "carbohydrates": "Good source: > 30 g", "carbohydrates": "High in: > 60 g", "cholesterol": "Low: < 20 mg", "potassium": "Good source: > 330 mg", "potassium": "High in: > 700 mg", EMPTY: EMPTY, EMPTY: EMPTY, EMPTY: EMPTY, EMPTY: EMPTY, "times": "Less than 15 minutes", "times": "Less than 30 minutes", "times": "Less than 1 hour", "times": "Less than 2 hours", "times": "Less than 4 hours", "dishes": "Appetizers & Snacks", "dishes": "Main Dishes", "dishes": "Side Dishes, Breads & Rolls", "dishes": "Soups, Salads & Sandwiches", "dishes": "Desserts & Beverages"]
- end
-
- on dbNum dbName
- if dbName = "recipe" then
- set dbNum to 0
- else
- if dbName = "beauty" then
- set dbNum to 1000
- else
- if dbName = "prep time" then
- set dbNum to 2000
- else
- if dbName = "instruction" then
- set dbNum to 3000
- else
- if dbName = "ingredient" then
- set dbNum to 4000
- else
- if dbName = "terms" then
- set dbNum to 5000
- else
- if dbName = "term photo" then
- set dbNum to 6000
- else
- if dbName = "nutrition" then
- set dbNum to 7000
- else
- if dbName = "utensil" then
- set dbNum to 8000
- else
- if dbName = "dish type" then
- set dbNum to 9000
- else
- if dbName = "tables" then
- set dbNum to 10000
- else
- if dbName = "personal recipe" then
- set dbNum to 3000
- else
- if dbName = "personal category" then
- set dbNum to 5000
- else
- if dbName = "meal plan" then
- set dbNum to 14000
- else
- set dbNum to dbName
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- return dbNum
- end
-
- on dbBeginSession
- global gDBObject, gDBResult, gDBSearchPath
- DBEndSession()
- if the machineType = 256 then
- openXLib("DBWidget.DLL")
- set gDBObject to DBWidget(mnew)
- set dbPath to gDBSearchPath & "PCDB\FULLDB"
- else
- openXLib("DBWidget")
- set gDBObject to DBWidget(mnew)
- set dbPath to the pathName & "MACDB:FULLDB"
- end if
- set gDBResult to gDBObject(mOpenDB, dbPath, 1)
- return gDBResult
- end
-
- on DBBeginSaveSession
- global gDBObject, gDBResult, gOriginPath
- DBEndSession()
- if the machineType = 256 then
- openXLib("DBWidget.DLL")
- set gDBObject to DBWidget(mnew)
- set dbPath to gOriginPath & "DATA\USERDB"
- else
- openXLib("DBWidget")
- set gDBObject to DBWidget(mnew)
- set dbPath to gOriginPath & "DATA:USERDB"
- end if
- set gDBResult to gDBObject(mOpenDB, dbPath, 2)
- return gDBResult
- end
-
- on DBBeginSearchSession
- global gDBObject, gDBResult, gOriginPath
- DBEndSession()
- if the machineType = 256 then
- openXLib("DBWidget.DLL")
- set gDBObject to DBWidget(mnew)
- set dbPath to gOriginPath & "DATA\SRCHDB"
- else
- openXLib("DBWidget")
- set gDBObject to DBWidget(mnew)
- set dbPath to gOriginPath & "DATA:SRCHDB"
- end if
- set gDBResult to gDBObject(mOpenDB, dbPath, 3)
- return gDBResult
- end
-
- on DBBeginBothSession
- global gDBObject, gDBResult, gOriginPath
- DBEndSession()
- if the machineType = 256 then
- openXLib("DBWidget.DLL")
- set gDBObject to DBWidget(mnew)
- set dbPath to the pathName & "PCDB\FULLDB"
- else
- openXLib("DBWidget")
- set gDBObject to DBWidget(mnew)
- set dbPath to the pathName & "MACDB:FULLDB"
- end if
- set gDBResult to gDBObject(mOpenDB, dbPath, 1)
- if the machineType = 256 then
- set dbPath to gOriginPath & "DATA\USERDB"
- else
- set dbPath to gOriginPath & "DATA:USERDB"
- end if
- set gDBResult to gDBObject(mOpenDB, dbPath, 2)
- return gDBResult
- end
-
- on DBEndSession
- global gDBObject
- if objectp(gDBObject) then
- gDBObject(mdispose)
- end if
- end
-
- on DBGetRecord keyID, dbName
- global gDBObject, gDBResult, gGRkeyID, gGRDBNum
- set dbNum to dbNum(dbName)
- set gDBResult to gDBObject(mGetDBRecord, integer(keyID), dbNum, 1)
- if gDBResult = 2 then
- set gGRkeyID to keyID
- set gGRDBNum to dbNum
- end if
- return gDBResult
- end
-
- on DBNextRecord dbName
- global gDBObject, gDBResult
- set dbNum to dbNum(dbName)
- set gDBResult to gDBObject(mNextDBRecord, dbNum, 1)
- return gDBResult
- end
-
- on DBGetField fieldNum
- global gDBObject, gDBResult, gGRkeyID, gGRDBNum
- if gDBResult = 0 then
- return gDBObject(mGetDBField, fieldNum, 1)
- else
- return 0
- end if
- end
-
- on DBStartSearch keyID, fieldNum
- global gDBObject, gDBResult
- if gDBResult >= 0 then
- set gDBResult to gDBObject(mStartDBSearch, integer(keyID), fieldNum, 3)
- end if
- return gDBResult
- end
-
- on DBAddSearch keyID, fieldNum
- global gDBObject, gDBResult
- if gDBResult >= 0 then
- set gDBResult to gDBObject(mAddDBSearch, integer(keyID), fieldNum, 3)
- end if
- return gDBResult
- end
-
- on DBGetResult num
- global gDBObject, gDBResult
- if gDBResult > 0 then
- set gDBResult to gDBObject(mGetDBResults, num, 3)
- return gDBResult
- else
- return 0
- end if
- end
-
- on DBSetRecord dbName, aString
- global gDBObject, gDBResult
- set dbNum to dbNum(dbName)
- if gDBResult >= 0 then
- set gDBResult to gDBObject(mSetDBRecord, dbNum, aString, 2)
- end if
- return gDBResult
- end
-
- on DBGetSetRecord keyID, dbName
- global gDBObject, gDBResult, gGRkeyID, gGRDBNum
- set dbNum to dbNum(dbName)
- set gDBResult to gDBObject(mGetDBRecord, integer(keyID), dbNum, 2)
- return gDBResult
- end
-
- on DBNextSetRecord dbName
- global gDBObject, gDBResult
- set dbNum to dbNum(dbName)
- if gDBResult >= 0 then
- set gDBResult to gDBObject(mNextDBRecord, dbNum, 2)
- end if
- return gDBResult
- end
-
- on DBGetSetField fieldNum
- global gDBObject, gDBResult, gGRkeyID, gGRDBNum
- if gDBResult = 0 then
- return gDBObject(mGetDBField, integer(fieldNum), 2)
- else
- return 0
- end if
- end
-
- on DBDeleteRecord dbName, fieldID
- global gDBObject, gDBResult
- set dbNum to dbNum(dbName)
- if gDBResult >= 0 then
- set gDBResult to gDBObject(mDeleteDBRecord, dbNum, integer(fieldID), 2)
- end if
- return gDBResult
- end
-